INSTALL_DIR = /usr/local/lib
HEADER_INSTALL_LIB = /usr/local/include
CC=g++
#PLATFORMS: WINDOWS_PLATFORM
CPPFLAGS=-g3 -Iinclude/ -I/home/caffeine/PF/irrlicht-1.8/include -IC:\PROG\lampe\include -IC:\PF\irrlicht-1.8\include -DLINUX_PLATFORM
LDFLAGS=-Lstatic

ifeq ($(OS),Windows_NT)
    PLATFORM=WINDOWS_PLATFORM
	OS=Windows
	DELETE = rm
else
    PLATFORM=LINUX_PLATFORM
	OS=Linux
	DELETE = rm
endif

SOURCES= source/irrlampe.cpp \
source/xml/Tags/animation.cpp \
source/xml/Tags/animation.cpp \
source/xml/Tags/animation.cpp \
source/xml/Tags/animation_item.cpp \
source/xml/Tags/animator.cpp \
source/xml/Tags/billboard.cpp \
source/xml/Tags/findbyid.cpp \
source/xml/Tags/material.cpp \
source/xml/Tags/material__flag.cpp \
source/xml/Tags/material_image.cpp \
source/xml/Tags/mesh_join.cpp \
source/xml/Tags/mesh_skin.cpp \
source/xml/Tags/terrain.cpp \
source/xml/Tags/skybox.cpp \
source/xml/Tags/utils/base_emitter.cpp \
source/xml/Tags/utils/base_gui.cpp \
source/xml/Tags/utils/base_scenenode.cpp \
source/shaders/layout.cpp \
source/xml/Tags/reg.cpp \
source/animation/CAnimation.cpp \
source/animation/CAnimationDB.cpp \
source/animation/CAnimationRecord.cpp \
source/animator/CJointUpdater.cpp \
source/shaders/layout.cpp

OBJECTS=$(SOURCES:.cpp=.o)

all:static_irrLampe

static_irrLampe: $(OBJECTS)
	ar  rcs lib/$(OS)/libirrLampe.a $(OBJECTS)
	ranlib lib/$(OS)/libirrLampe.a
#	$(CC) $(LDFLAGS) $(OBJECTS) -o $@

%.d:%.cpp
	$(CXX) $(CPPFLAGS) -MM -MF $@ $<
help:
	@echo "set system edviroment \"LAMPE_HEADERS\""
clean:
	rm $(OBJECTS)
install:
	@echo "Copy headers devepol files and lib file..."
	@cp -f -r include/lampe $(HEADER_INSTALL_LIB)
	@chmod a+rwx -R $(HEADER_INSTALL_LIB)/lampe
	@cp -f -r -u lib/Linux/libirrLampe.a $(INSTALL_DIR)/libirrLampe.a
	@chmod a+rwx $(INSTALL_DIR)/libirrLampe.a
	@echo "Done"
